﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VNPT.Data;
using VNPT.DoiSoat.BaoCao;

namespace VNPT.DoiSoat
{
    public partial class fBaoCao : DevExpress.XtraEditors.XtraForm
    {
        public fBaoCao()
        {
            InitializeComponent();
            this.Shown += (a, e) =>
            {
                this.textEdit1.Text = DoiSoatSetting.NGUOILAP_BAOCAO;
            };
        }
        DbNetData _Db;
        public fBaoCao(DbNetData Db)
            : this()
        {
            _Db = Db;
        }
        VNPT.Core.uBase u = new Core.uBase();
        private void btnChon_Click(object sender, EventArgs e)
        {
            using (new DevExpress.Utils.WaitDialogForm("Vui lòng chờ...","Đang tải dữ liệu"))
            {
                u = null;
                this.panelControl2.Controls.Clear();
                this.panelControl2.Refresh();
                if (comboBoxEdit1.EditValue != null)
                {
                    var b = comboBoxEdit1.SelectedIndex;// comboBoxEdit1.Text.Substring(5, 3);
                    switch (b)
                    {
                        case 0:
                            u = new uBC_1088();
                            break;
                        case 1:
                            u = new uBC_TH_GTGT_BC_NAM();
                            break;
                        case 2:
                            u = new uBC_TH_GTGT();
                            break;
                        default:
                            u = new uBC_1088();
                            break;
                    }
                    DoiSoatSetting.NGUOILAP_BAOCAO = this.textEdit1.Text;
                    u.DbServer = _Db;
                    u.LoadSetting();
                    u.Dock = System.Windows.Forms.DockStyle.Fill;
                    this.panelControl2.Controls.Add(u);
                }
            }
        }
    }
}
